﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using wsn;

namespace form
{
    public partial class Form1 : Form
    {
        private Service svc=null;
        private APIHost api=null;
        public Form1()
        {
            InitializeComponent();
        }

        private void btn_openAP_Click(object sender, EventArgs e)
        {
            if (svc == null)
            {
                svc = new Service();
                try
                {
                    svc.open();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            if (api == null)
            {
                api = new APIHost();
                api.OpenAPI();
            }
        }

        private void btn_close_Click(object sender, EventArgs e)
        {
            if (svc != null)
                svc.close();
            svc = null;
            Console.WriteLine("close ok");
        }
    }
}
